#include "TViewRT.h"


TViewRT::TViewRT( ID3D10Device* pd3dDevice, D3D10_TEXTURE2D_DESC* pTexDesc )
{
    pTexDesc->BindFlags		= D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
    pTexDesc->Usage			= D3D10_USAGE_DEFAULT;
    pTexDesc->CPUAccessFlags = NULL;

    pd3dDevice->CreateTexture2D( pTexDesc, NULL, &m_pTexture );
    pd3dDevice->CreateShaderResourceView( m_pTexture, NULL, &m_pSRV );
    pd3dDevice->CreateRenderTargetView( m_pTexture, NULL, &m_pRTV );

	float ClearColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
    pd3dDevice->ClearRenderTargetView( m_pRTV, ClearColor );
}
//TViewRT::TViewRT(ID3D10Device* pd3dDevice)
//{
//	// Create Source and Dest textures
//    D3D10_TEXTURE2D_DESC m_TextureDesc;dstex;
//    dstex.Width			= g_iTextureRTSize;
//    dstex.Height		= g_iTextureRTSize;
//    dstex.MipLevels		= 1;
//    dstex.Format		= DXGI_FORMAT_R8G8B8A8_UNORM;
//    dstex.SampleDesc.Count		= 1;
//    dstex.SampleDesc.Quality	= 0;
//    dstex.Usage					= D3D10_USAGE_DEFAULT;
//    dstex.BindFlags				= D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
//    dstex.CPUAccessFlags		= 0;
//    dstex.MiscFlags				= 0;
//    dstex.ArraySize				= 1;
//}
TViewRT::~TViewRT()
{
    m_pTexture->Release();
    m_pRTV->Release();
    m_pSRV->Release();
}
